<?php
declare(strict_types=1);
namespace Field;

class SysArticleReplyConst
{
    public const pk='ReplyID';
    public const index=['ReplyID'];
	public const fields=['ReplyID','ArticleID','UserID','CreateAt','UpdateAt','UserIP','Message','Status','IsDelete'];
	public const comment=['ReplyID'=>'回复ID','ArticleID'=>'文章ID','UserID'=>'用户ID','CreateAt'=>'创建时间','UpdateAt'=>'更新时间','UserIP'=>'发帖IP','Message'=>'文章短回复,像极了朋友圈','Status'=>'状态','IsDelete'=>'逻辑删除'];
	/*
    * @Field ReplyID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra auto_increment
    * @Privileges select,insert,update,references
    * @Comment 回复ID
    */
    public const ReplyID = 'ReplyID';
    /*
    * @Field ArticleID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 文章ID
    */
    public const ArticleID = 'ArticleID';
    /*
    * @Field UserID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key MUL
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 用户ID
    */
    public const UserID = 'UserID';
    /*
    * @Field CreateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 创建时间
    */
    public const CreateAt = 'CreateAt';
    /*
    * @Field UpdateAt
    * @Type timestamp
    * @Collation 
    * @Null YES
    * @Key 
    * @Default CURRENT_TIMESTAMP
    * @Extra on update CURRENT_TIMESTAMP
    * @Privileges select,insert,update,references
    * @Comment 更新时间
    */
    public const UpdateAt = 'UpdateAt';
    /*
    * @Field UserIP
    * @Type varchar(20)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 发帖IP
    */
    public const UserIP = 'UserIP';
    /*
    * @Field Message
    * @Type varchar(512)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 文章短回复,像极了朋友圈
    */
    public const Message = 'Message';
    /*
    * @Field Status
    * @Type int(11)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 状态
    */
    public const Status = 'Status';
    /*
    * @Field IsDelete
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 逻辑删除
    */
    public const IsDelete = 'IsDelete';
}

class SysArticleReplyColumns
{
public  int $ReplyID;
   public  int $ArticleID;
   public  int $UserID;
   public  ?string $CreateAt='';
   public  ?string $UpdateAt='';
   public  ?string $UserIP='';
   public  ?string $Message='';
   public  int $Status=0;
   public  int $IsDelete=0;
	public function toArray():array
	{
		return [
'ReplyID'=>$this->ReplyID,
    'ArticleID'=>$this->ArticleID,
    'UserID'=>$this->UserID,
    'CreateAt'=>$this->CreateAt,
    'UpdateAt'=>$this->UpdateAt,
    'UserIP'=>$this->UserIP,
    'Message'=>$this->Message,
    'Status'=>$this->Status,
    'IsDelete'=>$this->IsDelete,        ];
	}
}

class SysArticleReplyRow
{
	public SysArticleReplyColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'ReplyID' => $this->data->ReplyID,
        'ArticleID' => $this->data->ArticleID,
        'UserID' => $this->data->UserID,
        'CreateAt' => $this->data->CreateAt,
        'UpdateAt' => $this->data->UpdateAt,
        'UserIP' => $this->data->UserIP,
        'Message' => $this->data->Message,
        'Status' => $this->data->Status,
        'IsDelete' => $this->data->IsDelete, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new SysArticleReplyColumns();
        isset($data['ReplyID']) && $this->data->ReplyID = (int)$data['ReplyID'];
           isset($data['ArticleID']) && $this->data->ArticleID = (int)$data['ArticleID'];
           isset($data['UserID']) && $this->data->UserID = (int)$data['UserID'];
           isset($data['CreateAt']) && $this->data->CreateAt = (string)$data['CreateAt'];
           isset($data['UpdateAt']) && $this->data->UpdateAt = (string)$data['UpdateAt'];
           isset($data['UserIP']) && $this->data->UserIP = (string)$data['UserIP'];
           isset($data['Message']) && $this->data->Message = (string)$data['Message'];
           isset($data['Status']) && $this->data->Status = (int)$data['Status'];
           isset($data['IsDelete']) && $this->data->IsDelete = (int)$data['IsDelete'];
    }
}
?>